package br.ujr.dynamicproxy;

import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

import javax.persistence.EntityManager;
import javax.persistence.Persistence;

public class Main {
	
	public static void main(String[] args) {
		EntityManager em = Persistence.createEntityManagerFactory("teste").createEntityManager();
		
		ITransacao clientService = new ClienteServiceBean();
		
		clientService = (ITransacao)Decorator.withTransacao(clientService, ITransacao.class, em);
		
		clientService.save();
		clientService.remove();
	}
	
}
